-
Notifications
You must be signed in to change notification settings - Fork 29.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bootstrap: delay the instantiation of maps in per-context scripts #27371
Conversation
Instantiating maps renders the snapshot non-rehashable (v8 currently fails silently during `CreateBlob()`). Then the hash seed would always be the same and not recomputed if custom V8 snapshot is enabled. This patch delays the instantiation of the maps in domexception.js and make it lazy.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM … do you know how much work would be necessary to support this in V8?
@addaleax Should be pretty easy to return the status back, I'll submit a proposed API change in the upstream. I am not entirely sure if it actually make sense to return this status back though - at least judging from the TODOs in V8, the plan is to make the status always true and obsolete in the future, but I guess it does not hurt much to have an always true return value either, and it seems to take quite some effort to make everything rehashable so that probably won't happen anytime soon. EDIT: also if you are asking about how much work it would take to support rehashing these types in V8...I don't actually know? But it seems nontrivial. (I guess only @hashseed knows ;) |
I also uploaded https://chromium-review.googlesource.com/c/v8/v8/+/1578661 but I guess something like that won't happen very soon. |
Can we add an explicit fail so the code doesn't revert? |
@refack There is no way for us to check this yet (that's why there is https://chromium-review.googlesource.com/c/v8/v8/+/1578661, or at least until https://bugs.chromium.org/p/v8/issues/detail?id=6593 is fixed). Among other things, you'd need to traverse the heap to find types that use the hash seed and as an embedder there's no API for us to do that. |
Landed in 08a9c4a. |
Instantiating maps renders the snapshot non-rehashable (v8 currently fails silently during `CreateBlob()`). Then the hash seed would always be the same and not recomputed if custom V8 snapshot is enabled. This patch delays the instantiation of the maps in domexception.js and make it lazy. PR-URL: #27371 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Instantiating maps renders the snapshot non-rehashable (v8 currently fails silently during `CreateBlob()`). Then the hash seed would always be the same and not recomputed if custom V8 snapshot is enabled. This patch delays the instantiation of the maps in domexception.js and make it lazy. PR-URL: #27371 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
I filed an issue for rehashing Map/Set: https://bugs.chromium.org/p/v8/issues/detail?id=9187 I think it's non-trivial to do in-place, but inserting into a new backing store might be doable and good enough. |
Instantiating maps renders the snapshot non-rehashable
(v8 currently fails silently during
CreateBlob()
).Then the hash seed would always be the same and not
recomputed if custom V8 snapshot is enabled. This patch
delays the instantiation of the maps in domexception.js
and make it lazy.
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes